package com.example.demo.service;

import com.example.demo.entity.User;
import com.example.demo.repository.UserRepository;
import com.example.demo.result.Result;
import com.example.demo.result.ResultUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserService {
    @Resource
    private UserRepository userRepository;
    public Result addUser(){
        User user = new User();
        user.setId(1);
        user.setUsername("test");
        userRepository.save(user);
        return ResultUtils.success("添加成功");
    }
}
